package com.wxlsoft.config.model;

import java.util.LinkedList;
import java.util.List;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class EsbServiceFlow {

	/**
	 * 识别条件
	 */
	private String flowName;	
	
	public static List<EsbServiceFlow> parse(JsonNode data) {
		List<EsbServiceFlow> result = new LinkedList<>();
		ArrayNode records = (ArrayNode) data.get("adapterFlow");
		
		for (JsonNode record : records) {
			String flowName = record.toString().replaceAll("\"", "");
			result.add(new EsbServiceFlow(flowName));
		}
		return result;
	}

}
